<?php
/**
 * Routes configuration
 *
 * In this file, you set up routes to your controllers and their actions.
 * Routes are very important mechanism that allows you to freely connect
 * different urls to chosen controllers and their actions (functions).
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.app.config
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/views/pages/home.ctp)...
 */
    //Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */
    //Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));


function committeeitems($field_id){
    Router::connect("/:committee/project::itemid/:controller::$field_id/:action/:id/*",array(),array('pass'=>array('committee','itemid','id'),$field_id=>'[\d]+','itemid'=>'[\d]+'));
    Router::connect("/:committee/meeting::meetingid/:controller::$field_id/:action/:id/*",array(),array('pass'=>array('committee','meetingid','id'),$field_id=>'[\d]+','meetingid'=>'[\d]+'));
    Router::connect("/:committee/decision::decisionid/:controller::$field_id/:action/:id/*",array(),array('pass'=>array('committee','decisionid','id'),$field_id=>'[\d]+','decisionid'=>'[\d]+'));
    Router::connect("/:committee/project::itemid/:controller::$field_id/:action/*",array(),array('pass'=>array('committee','itemid'),$field_id=>'[\d]+','itemid'=>'[\d]+'));
    Router::connect("/:committee/meeting::meetingid/:controller::$field_id/:action/*",array(),array('pass'=>array('committee','meetingid'),$field_id=>'[\d]+','meetingid'=>'[\d]+'));
    Router::connect("/:committee/decision::decisionid/:controller::$field_id/:action/*",array(),array('pass'=>array('committee','decisionid'),$field_id=>'[\d]+','decisionid'=>'[\d]+'));
}


Router::connect('/install',array('controller'=>'installers','action'=>'install'));
Router::connect('/dircheck',array('controller'=>'installers','action'=>'dircheck'));
Router::connect('/database',array('controller'=>'installers','action'=>'database'));
Router::connect('/language',array('controller'=>'installers','action'=>'language'));
Router::connect('/syssettings',array('controller'=>'installers','action'=>'syssettings'));
Router::connect('/install/success',array('controller'=>'installers','action'=>'success'));

Router::connect('/login',array('controller'=>'users','action'=>'login'));
Router::connect('/logout',array('controller'=>'users','action'=>'logout'));
Router::connect('/ical',array('controller'=>'committees','action'=>'ical'));
Router::connect('/calendar',array('controller'=>'committees','action'=>'calendar'));
Router::connect('/',array('controller'=>'committees','action'=>'mainpage'));
Router::connect('/help',array('controller'=>'committees','action'=>'help'));
Router::connect('/profile',array('controller'=>'users','action'=>'profile'));
Router::connect('/getmultidata',array('controller'=>'committees','action'=>'getmultidata'));
Router::connect('/hash/:hashstring',array('controller'=>'hashes','action'=>'hash'),array('pass'=>array('hashstring')));
Router::connect('/hash1/:hashstring',array('controller'=>'hashes','action'=>'hash1'),array('pass'=>array('hashstring')));
Router::connect('/committee/cal/:committee_id',array('controller'=>'committees','action'=>'cal'),array('pass'=>array('committee_id')));

Router::connect('/roles/add/:committee_id',array('controller'=>'roles','action'=>'add'),array('pass'=>array('committee_id')));
Router::connect('/:committee/search/*',array('controller'=>'committees','action'=>'search'),array('pass'=>array('committee')));
Router::connect('/:controller/:action/*',array(),array('controller'=>'users|committees|protocols|ajaxes|titles|systemtodos|roles|templates|settings|logs|hashes|minutetypes|schemes'));
Router::connect('/users/resetpass/:id/:comm',array('controller'=>'users','action'=>'resetpass'),array('pass'=>array('id','comm')));

Router::connect("/:committee/:meetingid/node::node/:controller/:action/:id/*",array(),array('pass'=>array('committee','meetingid','node','id'),'meetingid'=>'[\d]+'));

    committeeitems('group_id');
    committeeitems('user_id');
    
Router::connect('/:committee/project::itemid/:controller/:action/:id/*',array(),array('pass'=>array('committee','itemid','id'),'itemid'=>'[\d]+','id'=>'[\d]+'));
Router::connect('/:committee/meeting::meetingid/:controller/:action/:id/*',array(),array('pass'=>array('committee','meetingid','id'),'meetingid'=>'[\d]+','id'=>'[\d]+'));
Router::connect('/:committee/decision::decisionid/:controller/:action/:id/*',array(),array('pass'=>array('committee','decisionid','id'),'decisionid'=>'[\d]+','id'=>'[\d]+'));
Router::connect('/:committee/project::itemid/:controller/:action/*',array(),array('pass'=>array('committee','itemid'),'itemid'=>'[\d]+'));
Router::connect('/:committee/meeting::meetingid/:controller/:action/*',array(),array('pass'=>array('committee','meetingid'),'meetingid'=>'[\d]+'));
Router::connect('/:committee/decision::decisionid/:controller/:action/*',array(),array('pass'=>array('committee','decisionid'),'decisionid'=>'[\d]+'));


Router::connect('/:committee/:controller/:action/:id/*',array(),array('pass'=>array('committee','id'),'id'=>'[\d]+'));
Router::connect('/:committee/:controller/:action/*',array(),array('pass'=>array('committee')));
Router::connect('/:committee/:controller/:action/:role/*',array('action'=>array('update','index')),array('pass'=>array('committee','role')));


/* Languages settings */

Router::connect('/lang/*',array('controller'=>'p28n','action'=>'change'));
Router::connect('/eng?/*',array('controller'=>'p28n','action'=>'shuntRequest','lang'=>'eng'));
Router::connect('/bm?/*',array('controller'=>'p28n','action'=>'shuntRequest','lang'=>'may'));
Router::parseExtensions('ics');  

?>
